//
//  RootVCOfVidio.m
//  ProjectA_ManualGuest
//
//  Created by dingcong on 16/6/21.
//  Copyright © 2016年 丁聪. All rights reserved.
//

#import "RootVCOfVidio.h"
#import "CellOfVidioImg.h"
#import "NetWorkingHandle.h"
#import "VidioModel.h"
@interface RootVCOfVidio ()
@property(nonatomic, retain)NSMutableArray *mArrOfData;
@end

@implementation RootVCOfVidio


- (void)dealloc{
    
    [_mArrOfData release];
    [super dealloc];
    
    
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
   
    
    [self GetData];
    self.tableView.backgroundColor = [UIColor clearColor];
    [self.tableView registerClass:[CellOfVidioImg class] forCellReuseIdentifier:@"pool"];
}


- (void)GetData{
    
    NSString *url = @"http://m.shougongke.com/index.php?c=Handclass&a=videoList&cate=0&page=1&price=0&sort=1&vid=18";
    NetWorkingHandle *net = [[NetWorkingHandle alloc]init];
    self.mArrOfData = [NSMutableArray array];
    [net netWorkingHandlerGetWithURL:url completion:^(id result, NSData *data, NSURLResponse *response, NSError *error) {
       
        NSLog(@"shujv:%@", result);
        NSArray *arr = [result objectForKey:@"data"];
        for (NSDictionary *dic in arr)
        {
            VidioModel *model = [[VidioModel alloc]init];
            [model setValuesForKeysWithDictionary:dic];
            
            [self.mArrOfData addObject:model];
            
            
            [model release];
        }
        
        
        
        
        [self.tableView reloadData];
        
    }];
    
    
    
    
    
    
    
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    
    return self.mArrOfData.count;
    
    
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 180;
    
    
    
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    CellOfVidioImg *cell = [tableView dequeueReusableCellWithIdentifier:@"pool"];
    
    cell.model = self.mArrOfData[indexPath.row];
    
    return cell;
    
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


@end
